﻿using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Simple.Services;
using Simple.Services.System.QHSEViolationCategory.Models;

namespace Simple.WebApi.Controllers.System;

/// <summary>
/// 安全观察与沟通管理
/// </summary>
[Route("QHSEViolationObserverAnalysis/[action]")]
[ApiController]
public class QHSEViolationObserverAnalysisController : ControllerBase
{
    private readonly ViolationObserveAnalysisService _violationObserverService;

    public QHSEViolationObserverAnalysisController(ViolationObserveAnalysisService violationObserverService)
    {
        _violationObserverService = violationObserverService;
    }
    /// <summary>
    /// 安全观察与沟通第一级
    /// </summary>
    [HttpPost]
    [CustomAuthorize("hdv_observeAnalysis")]
    public async Task<AppResult> ViolationObserveAnalysis([FromBody] ViolationAnalysisInput input)
    {
        var menus = await _violationObserverService.ViolationObserveAnalysisAsync(input);
        return AppResult.Status200OK(data: menus);
    }
    /// <summary>
    /// 人员的反应
    /// </summary>
    [HttpPost]
    [CustomAuthorize("hdv_observeAnalysis")]
    public async Task<AppResult> ViolationObserveRYFYAnalysis([FromBody] ViolationAnalysisInput input)
    {
        var menus = await _violationObserverService.ViolationObserve2AnalysisAsync(input, "人员的反应");
        return AppResult.Status200OK(data: menus);
    }
    /// <summary>
    /// 人员的位置
    /// </summary>
    [HttpPost]
    [CustomAuthorize("hdv_observeAnalysis")]
    public async Task<AppResult> ViolationObserveRYWZAnalysis([FromBody] ViolationAnalysisInput input)
    {
        var menus = await _violationObserverService.ViolationObserve2AnalysisAsync(input, "人员的位置");
        return AppResult.Status200OK(data: menus);
    }
    /// <summary>
    /// 个人防护装备
    /// </summary>
    [HttpPost]
    [CustomAuthorize("hdv_observeAnalysis")]
    public async Task<AppResult> ViolationObserveFHZBAnalysis([FromBody] ViolationAnalysisInput input)
    {
        var menus = await _violationObserverService.ViolationObserve2AnalysisAsync(input, "个人防护装备");
        return AppResult.Status200OK(data: menus);
    }
    /// <summary>
    /// 工具和设备
    /// </summary>
    [HttpPost]
    [CustomAuthorize("hdv_observeAnalysis")]
    public async Task<AppResult> ViolationObserveGZSBAnalysis([FromBody] ViolationAnalysisInput input)
    {
        var menus = await _violationObserverService.ViolationObserve2AnalysisAsync(input, "工具和设备");
        return AppResult.Status200OK(data: menus);
    }
    /// <summary>
    /// 程序与规程
    /// </summary>
    [HttpPost]
    [CustomAuthorize("hdv_observeAnalysis")]
    public async Task<AppResult> ViolationObserveCZGCAnalysis([FromBody] ViolationAnalysisInput input)
    {
        var menus = await _violationObserverService.ViolationObserve2AnalysisAsync(input, "程序与规程");
        return AppResult.Status200OK(data: menus);
    }
    /// <summary>
    /// 作业环境
    /// </summary>
    [HttpPost]
    [CustomAuthorize("hdv_observeAnalysis")]
    public async Task<AppResult> ViolationObserveZYHJAnalysis([FromBody] ViolationAnalysisInput input)
    {
        var menus = await _violationObserverService.ViolationObserve2AnalysisAsync(input, "作业环境");
        return AppResult.Status200OK(data: menus);
    }
}
